<?php
/**
 * CEOfox
 *
 * @copyright  Copyright 2011-2012 CEOfox, Inc.
 * @license    http://ceofox.com/pages/license
 * @version    $Id: ajax.class.php 27087 2013-05-24 09:40:17 $
 * @author     CEOfox, Inc.
 */
?>
<?php
defined('PHPFOX') or exit('NO DICE!');

class Follow_Component_Ajax_Notification_Ajax extends Phpfox_Ajax
{
    public function removeAll()
    {
        Phpfox::isUser(true);
        
        if (Phpfox::getService('follow.notifications.process')->deleteAll())
        {
            $this->hide('#js_notification_holder');
            $this->show('#js_no_notifications');
        }
        
        $this->hide('.table_clear_ajax');
    }
    public function delete()
    {
        Phpfox::isUser(true);
        if (Phpfox::getService('follow.notifications.process')->deleteById($this->get('id')))
        {
            $this->slideUp('#js_notification_' . $this->get('id'));
        }
    }
    
    public function getAll()
    {
        if (!Phpfox::isUser())
        {
            $this->call('<script type="text/javascript">window.location.href = \'' . Phpfox::getLib('url')->makeUrl('user.login') . '\';</script>');
        }
        else
        {
            Phpfox::getBlock('notification.link');    
        }
    }
    
}
?>

